Skip to content

feat(exporter/prometheus): add default_aggregation parameter to PrometheusMetricReader#5117

Open
Manvi2402 wants to merge 3 commits intoopen-telemetry:mainfrom
Manvi2402:fix/prometheus-default-aggregation
Open

feat(exporter/prometheus): add default_aggregation parameter to PrometheusMetricReader#5117
Manvi2402 wants to merge 3 commits intoopen-telemetry:mainfrom
Manvi2402:fix/prometheus-default-aggregation

Conversation

@Manvi2402
Copy link
Copy Markdown
Contributor

Description

Add default_aggregation parameter to PrometheusMetricReader to allow configuring default aggregation per instrument kind, aligning with the Prometheus Exporter spec.

Fixes #5109

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Test A: Added unit test test_default_aggregation in test_prometheus_exporter.py
    that verifies custom aggregation is correctly passed to the MetricReader.

Does This PR Require a Contrib Repo Change?

  • Yes. - Link to PR:
  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

self,
disable_target_info: bool = False,
prefix: str = "",
default_aggregation: Optional[Dict[type, Aggregation]] = None,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
default_aggregation: Optional[Dict[type, Aggregation]] = None,
default_aggregation: dict[type, Aggregation]] | None = None,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done thanks for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Stabilize Prometheus Exporter: Default Aggregation

2 participants